
require('../../common/header/index.js')
var _order_service=require('../../../service/order_service.js')
var $=require('jquery');

var _confirm_order={
    init:function(){
        this.loadInfo();
        this.bindEvents();
        return this;
    },

    loadInfo:function(){
        let orderId=1002;
        _order_service.getOrderById(
            orderId,
            function({data:res}){
                // <b id="time" th:text="${#dates.format(session.order.orderDate, 'yyyy/MM/dd hh:mm:ss')}"></b>
                //开始为界面赋值
                $('#time').text(res.orderDate);
                $('#firstName').text(res.billToFirstName);
                $('#lastName').text(res.billToLastName);
                $('#address1').text(res.billAddress1);
                $('#address2').text(res.billAddress2);
                $('#city').text(res.billCity);
                $('#state').text(res.billState);
                $('#zip').text(res.billZip);
                $('#billCountry').text(res.billCountry);


                $('#sFirstName').text(res.shipToFirstName);
                $('#sLastName').text(res.shipToLastName);
                $('#sAddress1').text(res.shipAddress1);
                $('#sAddress2').text(res.shipAddress2);
                $('#sCity').text(res.shipCity);
                $('#sState').text(res.shipState);
                $('#sZip').text(res.shipZip);
                $('#sCountry').text(res.shipZip);

            },
            function(errMsg){
                alert(errMsg.msg);
            }
        )
    },

    bindEvents:function(){
        $('#continue').on('click',function(){
            window.location.href='../../../view/order/shipping-form.html'
        })
    }

}

module.exports=_confirm_order.init()
